#ifndef __SENSOR_H__
#define __SENSOR_H__

#define POWER_ENTER_QUICK_SLEEP_FLAG (0x1688)
#define POWER_ENTER_SLOW_SLEEP_FLAG (0x1689)

/* unprovision device beacon adv time */
#define MESH_PBADV_TIME (60 * 1000) //600 Seconds

#define ELEMENT_NUM 2

#define PROVISION_LED_BLINK_COUNT 30

#define EVENT_REPORT_INTERVAL 600 //unit ms
#define EVENT_REPORT_RETRY 1

//#define SENSOR_UNPROV_PROMPT (1)

#define TWENTY_FOUR_HOURS_TIMEOUT (24 * 3600 * 1000) //48
//#define TWENTY_FOUR_HOURS_TIMEOUT (24 * 1000) //48
#define IV_UPDATE_TIMEOUT (15 * 1000)

#define SENSOR_OTA_TIMEOUT (120 * 1000)

#define ENTER_SLEEP_SLOW_CHECK_TIMEOUT (1000)         //unit ms
#define ENTER_SLEEP_QUICK_CHECK_TIMEOUT (100)         //unit ms
#define KEEP_WAKEUP_STATUS_MAX_TIME (5 * 60 * 1000)   //unit ms
#define ENTER_SLEEP_WAIT_LED_BLINK_TIMEOUT (3 * 1000) //unit ms

#define BOOTUP_ENTER_STANDBY_DELAY (60 * 1000) //unit ms
#define WAITING_OTA_TIME (30 * 1000)           //unit ms

#define SEQ_BACKUP_KEY "seq_b"

typedef enum _boot_reason_s
{
    BOOT_REASON_REBOOT = 0,
    BOOT_REASON_RESET = 0xF0,
    BOOT_REASON_PROVISION,
    BOOT_REASON_STANDBY,
    BOOT_REASON_RESUME_PROV
} boot_reason_e;

#define BOOT_REASON_TYPE_GET(reason) ((reason >> 16) & 0xFF)
#define BOOT_REASON_TYPE_SET(reason) ((reason << 16))

int sensor_set_delay_sleep_flag(unsigned char flag);
uint32_t sensor_get_boot_reason(void);

#endif
